/**
 * create by young (young2f@outlook.com) on 2020/12/3
 */
'use strict';
const model = require('../base/modelBase');
const _ = require('lodash');
module.exports = app => {
    const mongoose = app.mongoose;
    const schema = mongoose.Schema;
    const connect = app.mongooseDB.get('aiotBusiness');
    const json = {
        logType: { type: String, desc: '类型' },
        topic: { type: String},
         payload: { type: Object },
        deviceId: { type: String, desc: '设备编码' },
        deviceName: { type: String, desc: '设备名称' },
        status: { type: Number, desc: '状态' },
        time: { type: Number, desc: '时间' },
        createdAt: { type: Date, default: Date.now() },
        updatedAt: { type: Date, default: Date.now() },
    };
    const _model = _.cloneDeep(model);
    _.assign(_model, json);
    const _schema = new schema(
        _model,

    );
    return connect.model('BLog', _schema);
};
